Skip to content

[Explore Feed] Preference Selection #6502

Open
Williamrai wants to merge 55 commits intoexplore-feed-upgrade-designfrom
ef-onboarding-preference
Open

[Explore Feed] Preference Selection #6502
Williamrai wants to merge 55 commits intoexplore-feed-upgrade-designfrom
ef-onboarding-preference

Conversation

@Williamrai
Copy link
Copy Markdown
Collaborator

What does this do?

  • adds preference selection screen to onboarding flow

Phabricator:
https://phabricator.wikimedia.org/T418781

Williamrai and others added 30 commits March 27, 2026 10:01
- adds interest onboarding related screens
- adds string resources
- adds state models
- adds viewModel and interest placeholder screen
# Conflicts:
#	app/src/main/res/values-qq/strings.xml
#	app/src/main/res/values/strings.xml
…o ef-interest

# Conflicts:
#	app/src/main/java/org/wikipedia/onboarding/InitialOnboardingActivity.kt
…o ef-interest

# Conflicts:
#	app/src/main/res/values-qq/strings.xml
…o ef-interest

# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/res/values-qq/strings.xml
#	app/src/main/res/values/strings.xml
- moves view to its own composable functions
- adds string resource
- code fixes
…o ef-interest

# Conflicts:
#	app/src/main/java/org/wikipedia/onboarding/InitialOnboardingActivity.kt
#	app/src/main/res/values-qq/strings.xml
#	app/src/main/res/values/strings.xml
- adds deleteAllByType query
- adds viewModelFactory to PersonalizationViewModel.kt
- code fixes and cleanups
- writes DAO for article and topic interest
- update PersonalizationViewModel.kt and PersonalizationRepository.kt
- updates SelectionBottomBar to use count of both article and topics
- code fixes
- adds job in PersonalizationViewModel.kt
- code fixes
- update article and topic interest dao
- code fixes
- renames article and topic interest table
- adds string resource
- adds autoSize parameter to HtmlText
@Williamrai Williamrai added the WIP Work in progress label Apr 15, 2026
# Conflicts:
#	app/src/main/java/org/wikipedia/feed/personalization/FeedPreferenceScreen.kt
- adds FeedPreferenceRepository and FeedPreferenceState
# Conflicts:
#	app/src/main/java/org/wikipedia/feed/personalization/PersonalizationViewModel.kt
…o ef-onboarding-preference

# Conflicts:
#	app/src/main/java/org/wikipedia/feed/HomeFragment.kt
#	app/src/main/java/org/wikipedia/feed/personalization/PersonalizationScreen.kt
#	app/src/main/java/org/wikipedia/feed/personalization/PersonalizationViewModel.kt
#	app/src/main/java/org/wikipedia/feed/personalization/interest/InterestSelectionState.kt
#	app/src/main/java/org/wikipedia/onboarding/InitialOnboardingActivity.kt
#	app/src/main/res/values-qq/strings.xml
#	app/src/main/res/values/strings.xml
… using getArticlesWithTopic function

- adds loadFeedPreferenceScreen
- adds dev settings for selecting feed preference type
- code/ui fixes
- removes db query to get articleWithTopic
@Williamrai Williamrai added Ready for Review WIP Work in progress and removed WIP Work in progress Ready for Review labels Apr 20, 2026
- cache is only applied for topics
- code fixes
@Williamrai Williamrai added Ready for Review and removed WIP Work in progress labels Apr 20, 2026
Comment on lines +12 to +30
data class FeedPreferenceContent (
val title: String?,
val description: String?,
val imageUrl: String?,
val tag: String?
) {
companion object {
fun fromPageTitles(pageTitles: List<PageTitle>, topic: OnboardingTopic): List<FeedPreferenceContent> {
return pageTitles.map { page ->
FeedPreferenceContent(
title = page.displayText,
description = page.description,
imageUrl = page.thumbUrl,
tag = topic.displayTitle
)
}
}
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can reuse PageTitle class and assign topic.displayTitle to extract.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand, Could you clarify what you mean?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating a new data class, I think it's fine to just use PageTitle and treat extract as the tag in this case.

Comment on lines +255 to +256
HtmlText(
text = content.title,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When my primary language code is zh-tw, the articles' titles in the interest selection are correct, but when it pops up in the preference screen, the titles are in the incorrect language variant.

This happens when I don't have any topic selected and only select articles.

Comment on lines 384 to 397
PersonalizationViewModel(
interestSelectionRepository = InterestSelectionRepository(
interestTopicDao = AppDatabase.instance.topicInterestDao(),
interestArticleDao = AppDatabase.instance.articleInterestDao(),
historyEntryWithImageDao = AppDatabase.instance.historyEntryWithImageDao(),
readingListPageDao = AppDatabase.instance.readingListPageDao(),
wikiSite = WikipediaApp.instance.wikiSite
),
feedPreferenceRepository = FeedPreferenceRepository(
context = WikipediaApp.instance,
historyEntryWithImageDao = AppDatabase.instance.historyEntryWithImageDao(),
wikiSite = WikipediaApp.instance.wikiSite
)
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can have local variables for WikipediaApp.instance and AppDatabase.instance.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like this or inside the repository?

  initializer {
                val appDatabase = AppDatabase.instance
                val instance = WikipediaApp.instance
                PersonalizationViewModel(
                    interestSelectionRepository = InterestSelectionRepository(
                        interestTopicDao = AppDatabase.instance.topicInterestDao(),
                        interestArticleDao = AppDatabase.instance.articleInterestDao(),
                        historyEntryWithImageDao = AppDatabase.instance.historyEntryWithImageDao(),
                        readingListPageDao = AppDatabase.instance.readingListPageDao(),
                        wikiSite = WikipediaApp.instance.wikiSite
                    ),
                    homePreferenceRepository = HomePreferenceRepository(
                        context = WikipediaApp.instance,
                        historyEntryWithImageDao = AppDatabase.instance.historyEntryWithImageDao(),
                        wikiSite = WikipediaApp.instance.wikiSite
                    )
                )
            }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and use appDatabase.topicInterestDao()...etc below.

Comment thread app/src/main/java/org/wikipedia/settings/Prefs.kt Outdated
# Conflicts:
#	app/src/main/java/org/wikipedia/settings/Prefs.kt
#	app/src/main/res/values-qq/strings.xml
#	app/src/main/res/values/preference_keys.xml
#	app/src/main/res/values/strings.xml
val response = ServiceFactory.get(wikiSite).searchMoreLike(searchTerm = moreLikeSearchTerm, gsrLimit = 3, piLimit = 3)
return response.query?.pages?.map { page ->
HomePreferenceContent(
title = page.title,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use page.displayTitle(wikiSite.languageCode) instead of page.title, and that's why I suggested using PageTitle so you won't get confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants